﻿using pcs_winform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace pcs_shelldesktopdll
{
    public class Class1
    {
        public void mb(string context)
        {
            MessageBox.Show(context);
        }
        public void lvstartupdate()
        {
            try
            {
                Global.f1.listView1.BeginUpdate();
            }
            catch { }
        }
        public void lvendupdate()
        {
            try
            {
                Global.f1.listView1.EndUpdate();
            }
            catch { }
        }
        public void lvupdate(string path, string time, string size, string type)
        {
            try
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = path;
                lvi.SubItems.Add(time);
                lvi.SubItems.Add(size);
                lvi.SubItems.Add(type);
                Global.f1.listView1.Items.Add(lvi);
            }
            catch { }
        }
        public void cd(string path)
        {
            try
            {
                Global.f1.textBox1.Text = path;
            }
            catch { }
        }
        public void who(string username)
        {
            try
            {
                Global.f1.label1.Text += username;
            }
            catch { }
        }
        public void quota(string freespace, string totalspace)
        {
            try
            {
                Global.f1.label2.Text += freespace + "/" + totalspace;
            }
            catch { }
        }
        public string captcha(string image)
        {
            Form4 f = new Form4(image);
            f.ShowDialog();
            return f.result;
        }
        public void setdownloadprocess(string downloaded, string total, string speed, string time, double process)
        {
            try
            {
                Global.f1.toolStripStatusLabel1.Text = "开始下载...";
                Global.f1.toolStripStatusLabel2.Text = downloaded + "/" + total;
                Global.f1.toolStripStatusLabel3.Text = speed+"/s";
                Global.f1.toolStripStatusLabel4.Text = time;
                Global.f1.toolStripStatusLabel5.Text = ((int)process).ToString()+"%";
                Global.f1.toolStripProgressBar1.Value = (int)process;
            }
            catch { }
        }
        public void settoolStripStatusLabel1Text(string text)
        {
            try
            {
                Global.f1.toolStripStatusLabel1.Text = text;
            }
            catch { }
        }
        public void CS()
        {
            try
            {

                // Global.f1.textBox1.Text = "我是GUI";
            }
            catch { }
        }

    }
}
